home *** CD-ROM | disk | FTP | other *** search
- unit TabSImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, DelLib, Tabs;
-
- type
- TTabSetX = class(TActiveXControl, ITabSetX)
- private
- { Private declarations }
- FDelphiControl: TTabSet;
- FEvents: ITabSetXEvents;
- procedure ChangeEvent(Sender: TObject; NewTab: Integer;
- var AllowChange: Boolean);
- procedure ClickEvent(Sender: TObject);
- procedure MeasureTabEvent(Sender: TObject; Index: Integer;
- var TabWidth: Integer);
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_AutoScroll: WordBool; safecall;
- function Get_BackgroundColor: TColor; safecall;
- function Get_Cursor: Smallint; safecall;
- function Get_DitherBackground: WordBool; safecall;
- function Get_Enabled: WordBool; safecall;
- function Get_EndMargin: Integer; safecall;
- function Get_FirstIndex: Integer; safecall;
- function Get_Font: Font; safecall;
- function Get_SelectedColor: TColor; safecall;
- function Get_StartMargin: Integer; safecall;
- function Get_Style: TxTabStyle; safecall;
- function Get_TabHeight: Integer; safecall;
- function Get_TabIndex: Integer; safecall;
- function Get_Tabs: IStrings; safecall;
- function Get_UnselectedColor: TColor; safecall;
- function Get_Visible: WordBool; safecall;
- function Get_VisibleTabs: Integer; safecall;
- procedure AboutBox; safecall;
- procedure SelectNext(Direction: WordBool); safecall;
- procedure Set_AutoScroll(Value: WordBool); safecall;
- procedure Set_BackgroundColor(Value: TColor); safecall;
- procedure Set_Cursor(Value: Smallint); safecall;
- procedure Set_DitherBackground(Value: WordBool); safecall;
- procedure Set_Enabled(Value: WordBool); safecall;
- procedure Set_EndMargin(Value: Integer); safecall;
- procedure Set_FirstIndex(Value: Integer); safecall;
- procedure Set_Font(const Value: Font); safecall;
- procedure Set_SelectedColor(Value: TColor); safecall;
- procedure Set_StartMargin(Value: Integer); safecall;
- procedure Set_Style(Value: TxTabStyle); safecall;
- procedure Set_TabHeight(Value: Integer); safecall;
- procedure Set_TabIndex(Value: Integer); safecall;
- procedure Set_Tabs(const Value: IStrings); safecall;
- procedure Set_UnselectedColor(Value: TColor); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- end;
-
- implementation
- uses TabSPg;
- { TTabSetX }
-
- procedure TTabSetX.InitializeControl;
- begin
- FDelphiControl := Control as TTabSet;
- FDelphiControl.OnChange := ChangeEvent;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnMeasureTab := MeasureTabEvent;
- end;
-
- procedure TTabSetX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as ITabSetXEvents;
- end;
-
- procedure TTabSetX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- { Define property pages here. Property pages are defined by calling
- DefinePropertyPage with the class id of the page. For example,
- DefinePropertyPage(Class_TabSetXPage); }
- end;
-
- function TTabSetX.Get_AutoScroll: WordBool;
- begin
- Result := FDelphiControl.AutoScroll;
- end;
-
- function TTabSetX.Get_BackgroundColor: TColor;
- begin
- Result := FDelphiControl.BackgroundColor;
- end;
-
- function TTabSetX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TTabSetX.Get_DitherBackground: WordBool;
- begin
- Result := FDelphiControl.DitherBackground;
- end;
-
- function TTabSetX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TTabSetX.Get_EndMargin: Integer;
- begin
- Result := FDelphiControl.EndMargin;
- end;
-
- function TTabSetX.Get_FirstIndex: Integer;
- begin
- Result := FDelphiControl.FirstIndex;
- end;
-
- function TTabSetX.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TTabSetX.Get_SelectedColor: TColor;
- begin
- Result := FDelphiControl.SelectedColor;
- end;
-
- function TTabSetX.Get_StartMargin: Integer;
- begin
- Result := FDelphiControl.StartMargin;
- end;
-
- function TTabSetX.Get_Style: TxTabStyle;
- begin
- Result := Ord(FDelphiControl.Style);
- end;
-
- function TTabSetX.Get_TabHeight: Integer;
- begin
- Result := FDelphiControl.TabHeight;
- end;
-
- function TTabSetX.Get_TabIndex: Integer;
- begin
- Result := FDelphiControl.TabIndex;
- end;
-
- function TTabSetX.Get_Tabs: IStrings;
- begin
- GetOleStrings(FDelphiControl.Tabs, Result);
- end;
-
- function TTabSetX.Get_UnselectedColor: TColor;
- begin
- Result := FDelphiControl.UnselectedColor;
- end;
-
- function TTabSetX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- function TTabSetX.Get_VisibleTabs: Integer;
- begin
- Result := FDelphiControl.VisibleTabs;
- end;
-
- procedure TTabSetX.AboutBox;
- begin
- ShowTabSetXAbout;
- end;
-
- procedure TTabSetX.SelectNext(Direction: WordBool);
- begin
-
- end;
-
- procedure TTabSetX.Set_AutoScroll(Value: WordBool);
- begin
- FDelphiControl.AutoScroll := Value;
- end;
-
- procedure TTabSetX.Set_BackgroundColor(Value: TColor);
- begin
- FDelphiControl.BackgroundColor := Value;
- end;
-
- procedure TTabSetX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TTabSetX.Set_DitherBackground(Value: WordBool);
- begin
- FDelphiControl.DitherBackground := Value;
- end;
-
- procedure TTabSetX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TTabSetX.Set_EndMargin(Value: Integer);
- begin
- FDelphiControl.EndMargin := Value;
- end;
-
- procedure TTabSetX.Set_FirstIndex(Value: Integer);
- begin
- FDelphiControl.FirstIndex := Value;
- end;
-
- procedure TTabSetX.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TTabSetX.Set_SelectedColor(Value: TColor);
- begin
- FDelphiControl.SelectedColor := Value;
- end;
-
- procedure TTabSetX.Set_StartMargin(Value: Integer);
- begin
- FDelphiControl.StartMargin := Value;
- end;
-
- procedure TTabSetX.Set_Style(Value: TxTabStyle);
- begin
- FDelphiControl.Style := TTabStyle(Value);
- end;
-
- procedure TTabSetX.Set_TabHeight(Value: Integer);
- begin
- FDelphiControl.TabHeight := Value;
- end;
-
- procedure TTabSetX.Set_TabIndex(Value: Integer);
- begin
- FDelphiControl.TabIndex := Value;
- end;
-
- procedure TTabSetX.Set_Tabs(const Value: IStrings);
- begin
- SetOleStrings(FDelphiControl.Tabs, Value);
- end;
-
- procedure TTabSetX.Set_UnselectedColor(Value: TColor);
- begin
- FDelphiControl.UnselectedColor := Value;
- end;
-
- procedure TTabSetX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TTabSetX.ChangeEvent(Sender: TObject; NewTab: Integer;
- var AllowChange: Boolean);
- var
- TempAllowChange: WordBool;
- begin
- TempAllowChange := WordBool(AllowChange);
- if FEvents <> nil then FEvents.OnChange(NewTab, TempAllowChange);
- AllowChange := Boolean(TempAllowChange);
- end;
-
- procedure TTabSetX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TTabSetX.MeasureTabEvent(Sender: TObject; Index: Integer;
- var TabWidth: Integer);
- var
- TempTabWidth: Integer;
- begin
- TempTabWidth := Integer(TabWidth);
- if FEvents <> nil then FEvents.OnMeasureTab(Index, TempTabWidth);
- TabWidth := Integer(TempTabWidth);
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TTabSetX,
- TTabSet,
- Class_TabSetX,
- 27,
- '{5A5659DB-7975-11D0-BE02-00A024D1875C}');
- end.
-